<web-app version="2.5"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>Encuestame</display-name>
    <description>online survey system</description>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
           /WEB-INF/spring-app-context.xml
         </param-value>
    </context-param>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/classes/log4j.xml</param-value>
    </context-param>

    <jsp-config>
        <taglib>
            <taglib-uri>enmetags</taglib-uri>
            <taglib-location>/WEB-INF/tld/emne-dojo.tld</taglib-location>
        </taglib>
    </jsp-config>

<!--      <filter> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter -->
<!--         </filter-class> -->
<!--       </filter> -->

<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>*.json</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>*.atom</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>*.rss</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/user/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/admon/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/settings/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/search/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/tweetpoll/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/poll/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/survey/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--         <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/cloud</url-pattern> -->
<!--     </filter-mapping> -->
<!--     <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/social/*</url-pattern> -->
<!--     </filter-mapping> -->
<!--      <filter-mapping> -->
<!--         <filter-name>SimplePageCachingFilter</filter-name> -->
<!--         <url-pattern>/home</url-pattern> -->
<!--     </filter-mapping> -->

    <!-- Allows attributes to be accessed on the next request -->
    <filter>
        <filter-name>flashMapFilter</filter-name>
        <filter-class>org.encuestame.core.filter.MapFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>flashMapFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--
    Enforce UTF-8 Character Encoding -->
    <filter>
        <filter-name>charEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <!--
        Hibernate's OpenSessionInView still required since we are using
        lazy-collection in method to get list of tasks & steps
    -->
    <filter>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <filter-class>org.encuestame.persistence.filter.SessionFilter</filter-class>
    </filter>
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/j_spring_security_check</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>*.json</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/activity/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/user/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/admon/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/settings/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/search/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/tweetpoll/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/poll/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/survey/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
        <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/cloud</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/social/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/tag/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
     <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/home</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/setup*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>/setup</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>charEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>cross-origin</filter-name>
        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>cross-origin</filter-name>
        <url-pattern>/activity/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.encuestame.mvc.listener.EnMeContext</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <listener>
       <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value />
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
       <servlet-name>Resource Servlet</servlet-name>
       <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
       <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
       <servlet-name>Resource Servlet</servlet-name>
       <url-pattern>/static/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>/user/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>/settings/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>/picture/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.pdf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.xls</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.cvs</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.atom</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.rss</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>encuestame-spring-dispacher</servlet-name>
        <url-pattern>*.json</url-pattern>
    </servlet-mapping> -->

   <!-- Cometd Servlet -->
    <servlet>
        <servlet-name>cometd</servlet-name>
        <servlet-class>org.cometd.server.CometdServlet</servlet-class>
        <init-param>
            <param-name>transports</param-name>
            <param-value>org.cometd.websocket.server.WebSocketTransport</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>cometd</servlet-name>
        <url-pattern>/activity/*</url-pattern>
    </servlet-mapping>

<!--     <error-page>
        <error-code>500</error-code>
        <location>/500page.jsp</location>
    </error-page> -->

<!--     <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>error.jsp</location>
    </error-page>

    <error-page>
        <error-code>403</error-code>
        <location>403.jsp</location>
    </error-page>

    <error-page>
        <error-code>404</error-code>
        <location>404.jsp</location>
    </error-page>     -->

    <welcome-file-list>
        <welcome-file>home</welcome-file>
    </welcome-file-list>

    <session-config>
		<session-timeout>180</session-timeout>
	</session-config>

</web-app>
